package edu.upf.grupE.Entities;

/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 1.1.2.1</a>, using an XML
 * Schema.
 * $Id$
 */

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * Class Picture.
 * 
 * @version $Revision$ $Date$
 */
public class Picture implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _id.
     */
    private long _id;

    /**
     * keeps track of state for field: _id
     */
    private boolean _has_id;

    /**
     * Field _name.
     */
    private java.lang.String _name;

    /**
     * Field _authorList.
     */
    private java.util.List _authorList;

    /**
     * Field _date.
     */
    private org.exolab.castor.types.Date _date;

    /**
     * Field _textDescription.
     */
    private TextDescription _textDescription;

    /**
     * Field _geoLocalization.
     */
    private GeoLocalization _geoLocalization;

    /**
     * Field _fileDescriptor.
     */
    private FileDescriptor _fileDescriptor;

    /**
     * Field _areaList.
     */
    private java.util.List _areaList;


      //----------------/
     //- Constructors -/
    //----------------/

    public Picture() {
        super();
        this._authorList = new java.util.ArrayList();
        this._areaList = new java.util.ArrayList();
    }


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * 
     * @param vArea
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addArea(
            final Area vArea)
    throws java.lang.IndexOutOfBoundsException {
        this._areaList.add(vArea);
    }

    /**
     * 
     * 
     * @param index
     * @param vArea
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addArea(
            final int index,
            final Area vArea)
    throws java.lang.IndexOutOfBoundsException {
        this._areaList.add(index, vArea);
    }

    /**
     * 
     * 
     * @param vAuthor
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addAuthor(
            final java.lang.String vAuthor)
    throws java.lang.IndexOutOfBoundsException {
        this._authorList.add(vAuthor);
    }

    /**
     * 
     * 
     * @param index
     * @param vAuthor
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addAuthor(
            final int index,
            final java.lang.String vAuthor)
    throws java.lang.IndexOutOfBoundsException {
        this._authorList.add(index, vAuthor);
    }

    /**
     */
    public void deleteId(
    ) {
        this._has_id= false;
    }

    /**
     * Method enumerateArea.
     * 
     * @return an Enumeration over all possible elements of this
     * collection
     */
    public java.util.Enumeration enumerateArea(
    ) {
        return java.util.Collections.enumeration(this._areaList);
    }

    /**
     * Method enumerateAuthor.
     * 
     * @return an Enumeration over all possible elements of this
     * collection
     */
    public java.util.Enumeration enumerateAuthor(
    ) {
        return java.util.Collections.enumeration(this._authorList);
    }

    /**
     * Method getArea.
     * 
     * @param index
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     * @return the value of the Area at the given index
     */
    public Area getArea(
            final int index)
    throws java.lang.IndexOutOfBoundsException {
        // check bounds for index
        if (index < 0 || index >= this._areaList.size()) {
            throw new IndexOutOfBoundsException("getArea: Index value '" + index + "' not in range [0.." + (this._areaList.size() - 1) + "]");
        }
        
        return (Area) _areaList.get(index);
    }

    /**
     * Method getArea.Returns the contents of the collection in an
     * Array.  <p>Note:  Just in case the collection contents are
     * changing in another thread, we pass a 0-length Array of the
     * correct type into the API call.  This way we <i>know</i>
     * that the Array returned is of exactly the correct length.
     * 
     * @return this collection as an Array
     */
    public Area[] getArea(
    ) {
        Area[] array = new Area[0];
        return (Area[]) this._areaList.toArray(array);
    }

    /**
     * Method getAreaCount.
     * 
     * @return the size of this collection
     */
    public int getAreaCount(
    ) {
        return this._areaList.size();
    }

    /**
     * Method getAuthor.
     * 
     * @param index
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     * @return the value of the java.lang.String at the given index
     */
    public java.lang.String getAuthor(
            final int index)
    throws java.lang.IndexOutOfBoundsException {
        // check bounds for index
        if (index < 0 || index >= this._authorList.size()) {
            throw new IndexOutOfBoundsException("getAuthor: Index value '" + index + "' not in range [0.." + (this._authorList.size() - 1) + "]");
        }
        
        return (java.lang.String) _authorList.get(index);
    }

    /**
     * Method getAuthor.Returns the contents of the collection in
     * an Array.  <p>Note:  Just in case the collection contents
     * are changing in another thread, we pass a 0-length Array of
     * the correct type into the API call.  This way we <i>know</i>
     * that the Array returned is of exactly the correct length.
     * 
     * @return this collection as an Array
     */
    public java.lang.String[] getAuthor(
    ) {
        java.lang.String[] array = new java.lang.String[0];
        return (java.lang.String[]) this._authorList.toArray(array);
    }

    /**
     * Method getAuthorCount.
     * 
     * @return the size of this collection
     */
    public int getAuthorCount(
    ) {
        return this._authorList.size();
    }

    /**
     * Returns the value of field 'date'.
     * 
     * @return the value of field 'Date'.
     */
    public org.exolab.castor.types.Date getDate(
    ) {
        return this._date;
    }

    /**
     * Returns the value of field 'fileDescriptor'.
     * 
     * @return the value of field 'FileDescriptor'.
     */
    public FileDescriptor getFileDescriptor(
    ) {
        return this._fileDescriptor;
    }

    /**
     * Returns the value of field 'geoLocalization'.
     * 
     * @return the value of field 'GeoLocalization'.
     */
    public GeoLocalization getGeoLocalization(
    ) {
        return this._geoLocalization;
    }

    /**
     * Returns the value of field 'id'.
     * 
     * @return the value of field 'Id'.
     */
    public long getId(
    ) {
        return this._id;
    }

    /**
     * Returns the value of field 'name'.
     * 
     * @return the value of field 'Name'.
     */
    public java.lang.String getName(
    ) {
        return this._name;
    }

    /**
     * Returns the value of field 'textDescription'.
     * 
     * @return the value of field 'TextDescription'.
     */
    public TextDescription getTextDescription(
    ) {
        return this._textDescription;
    }

    /**
     * Method hasId.
     * 
     * @return true if at least one Id has been added
     */
    public boolean hasId(
    ) {
        return this._has_id;
    }

    /**
     * Method isValid.
     * 
     * @return true if this object is valid according to the schema
     */
    public boolean isValid(
    ) {
        try {
            validate();
        } catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    }

    /**
     * Method iterateArea.
     * 
     * @return an Iterator over all possible elements in this
     * collection
     */
    public java.util.Iterator iterateArea(
    ) {
        return this._areaList.iterator();
    }

    /**
     * Method iterateAuthor.
     * 
     * @return an Iterator over all possible elements in this
     * collection
     */
    public java.util.Iterator iterateAuthor(
    ) {
        return this._authorList.iterator();
    }

    /**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void marshal(
            final java.io.Writer out)
    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        Marshaller.marshal(this, out);
    }

    /**
     * 
     * 
     * @param handler
     * @throws java.io.IOException if an IOException occurs during
     * marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     */
    public void marshal(
            final org.xml.sax.ContentHandler handler)
    throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        Marshaller.marshal(this, handler);
    }

    /**
     */
    public void removeAllArea(
    ) {
        this._areaList.clear();
    }

    /**
     */
    public void removeAllAuthor(
    ) {
        this._authorList.clear();
    }

    /**
     * Method removeArea.
     * 
     * @param vArea
     * @return true if the object was removed from the collection.
     */
    public boolean removeArea(
            final Area vArea) {
        boolean removed = _areaList.remove(vArea);
        return removed;
    }

    /**
     * Method removeAreaAt.
     * 
     * @param index
     * @return the element removed from the collection
     */
    public Area removeAreaAt(
            final int index) {
        java.lang.Object obj = this._areaList.remove(index);
        return (Area) obj;
    }

    /**
     * Method removeAuthor.
     * 
     * @param vAuthor
     * @return true if the object was removed from the collection.
     */
    public boolean removeAuthor(
            final java.lang.String vAuthor) {
        boolean removed = _authorList.remove(vAuthor);
        return removed;
    }

    /**
     * Method removeAuthorAt.
     * 
     * @param index
     * @return the element removed from the collection
     */
    public java.lang.String removeAuthorAt(
            final int index) {
        java.lang.Object obj = this._authorList.remove(index);
        return (java.lang.String) obj;
    }

    /**
     * 
     * 
     * @param index
     * @param vArea
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void setArea(
            final int index,
            final Area vArea)
    throws java.lang.IndexOutOfBoundsException {
        // check bounds for index
        if (index < 0 || index >= this._areaList.size()) {
            throw new IndexOutOfBoundsException("setArea: Index value '" + index + "' not in range [0.." + (this._areaList.size() - 1) + "]");
        }
        
        this._areaList.set(index, vArea);
    }

    /**
     * 
     * 
     * @param vAreaArray
     */
    public void setArea(
            final Area[] vAreaArray) {
        //-- copy array
        _areaList.clear();
        
        for (int i = 0; i < vAreaArray.length; i++) {
                this._areaList.add(vAreaArray[i]);
        }
    }

    /**
     * 
     * 
     * @param index
     * @param vAuthor
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void setAuthor(
            final int index,
            final java.lang.String vAuthor)
    throws java.lang.IndexOutOfBoundsException {
        // check bounds for index
        if (index < 0 || index >= this._authorList.size()) {
            throw new IndexOutOfBoundsException("setAuthor: Index value '" + index + "' not in range [0.." + (this._authorList.size() - 1) + "]");
        }
        
        this._authorList.set(index, vAuthor);
    }

    /**
     * 
     * 
     * @param vAuthorArray
     */
    public void setAuthor(
            final java.lang.String[] vAuthorArray) {
        //-- copy array
        _authorList.clear();
        
        for (int i = 0; i < vAuthorArray.length; i++) {
                this._authorList.add(vAuthorArray[i]);
        }
    }

    /**
     * Sets the value of field 'date'.
     * 
     * @param date the value of field 'date'.
     */
    public void setDate(
            final org.exolab.castor.types.Date date) {
        this._date = date;
    }

    /**
     * Sets the value of field 'fileDescriptor'.
     * 
     * @param fileDescriptor the value of field 'fileDescriptor'.
     */
    public void setFileDescriptor(
            final FileDescriptor fileDescriptor) {
        this._fileDescriptor = fileDescriptor;
    }

    /**
     * Sets the value of field 'geoLocalization'.
     * 
     * @param geoLocalization the value of field 'geoLocalization'.
     */
    public void setGeoLocalization(
            final GeoLocalization geoLocalization) {
        this._geoLocalization = geoLocalization;
    }

    /**
     * Sets the value of field 'id'.
     * 
     * @param id the value of field 'id'.
     */
    public void setId(
            final long id) {
        this._id = id;
        this._has_id = true;
    }

    /**
     * Sets the value of field 'name'.
     * 
     * @param name the value of field 'name'.
     */
    public void setName(
            final java.lang.String name) {
        this._name = name;
    }

    /**
     * Sets the value of field 'textDescription'.
     * 
     * @param textDescription the value of field 'textDescription'.
     */
    public void setTextDescription(
            final TextDescription textDescription) {
        this._textDescription = textDescription;
    }

    /**
     * Method unmarshal.
     * 
     * @param reader
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @return the unmarshaled Picture
     */
    public static Picture unmarshal(
            final java.io.Reader reader)
    throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
        return (Picture) Unmarshaller.unmarshal(Picture.class, reader);
    }

    /**
     * 
     * 
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void validate(
    )
    throws org.exolab.castor.xml.ValidationException {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    }

}
